﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace PuzzleDiamonds
{
    // ScreenGame class
    //
    public class ScreenGame : Screen
    {
        private PuzzleDiamondsGame m_puzzleDiamondsGame;

        public ScreenGame(int pScreenID, Canvas pScreenCanvas)
            : base(pScreenID, pScreenCanvas)
        {
            m_puzzleDiamondsGame = new PuzzleDiamondsGame(new Scene(m_screenCanvas), 20, 12);
        }

        public override void OnActivate()
        {
            base.OnActivate();
            m_puzzleDiamondsGame.Reinit();
        }

        public override void OnMouseLeftClick(double pMouseX, double pMouseY)
        {
            base.OnMouseLeftClick(pMouseX, pMouseY);
            m_puzzleDiamondsGame.OnMouseClick(pMouseX, pMouseY);
        }

        public override void Update(double pTick)
        {
            base.Update(pTick);

            m_puzzleDiamondsGame.Update(pTick);

            if (m_puzzleDiamondsGame.State == GameState.gsEnd)
                ScreenManager.Instance().ActivateScreen((int)ScreenTypes.ctMain);
        }
    }
}
